<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="contain">
        <h2>今天天气很{{info}}</h2>
        <button @click="changeweather">点击切换</button>
        <!-- <button @click="isHot=!isHot">点击切换</button>
        简写方式 -->
    </div>
    <script>
        const vm = new Vue({
            el: '#contain',
            data: {
                isHot: true
            }, computed: {
                info() {
                    return this.isHot ? '炎热' : '凉爽'
                }
            },
            methods: {
                changeweather() {
                    return this.isHot = !this.isHot
                }

            }
        });
    </script>
</body>

</html>